﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jzy.BLL.SiteAdmin;
using Jzy.Model.SiteAdmin;
using Jzy.Core.Common.Web;
using Jzy.Core.Attach;

namespace Jzy.Web.SiteAdmin.Resume
{
    public partial class Detail : PageDetail
    {
        private string ResumeID
        {
            get
            {
                return Request.QueryString["ID"];
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DispInfo();
            }
        }

        private void DispInfo()
        {
            ResumeBO resume = new ResumeBO();

            ResumeInfo info = resume.GetInfo(ResumeID);

            EntityUtil.SetControl(pnlMain, info);
            Gender.Text = ((Jzy.Model.CRM.Gender)info.Gender).ToString();
            Birthday.Text = info.Birthday == null ? "" : ((DateTime)info.Birthday).ToString("yyyy-MM-dd");
            CertType.Text = ((Jzy.Model.SiteAdmin.CertType)info.CertType).ToString();

            AttachBO attach = new AttachBO(Jzy.Common.TableName.CmsResumeAttach);
            IEnumerable<AttachInfo> lstAttachs = attach.GetList(info.ID);
            if (lstAttachs.Count() > 0)
            {
                lnkAttach.Visible = true;
                lnkAttach.Text = lstAttachs.First().Name;
                lnkAttach.NavigateUrl = lstAttachs.First().DownloadUrl;
            }
            else
            {
                lnkAttach.Visible = false;
            }
        }
    }
}
